<div class="fm-content">
    <!-- 最上面标题栏 -->
    <div class="title">
        <i nz-icon [type]="'desktop'"></i>
        &nbsp;&nbsp;地面安保数据
    </div>
    <!-- 内容 -->
    <div class="work">

        <!-- 查询框 -->
        <div class="top">
            <!-- first-input -->
            <nz-select class="fm-input first-input" (nzOpenChange)="airportDic.load('0')"
                [(ngModel)]="fs.queryObject['airport:=']" [nzPlaceHolder]="'所属机场'">
                <nz-option *ngFor="let option of airportDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
                </nz-option>
                <nz-option *ngIf="airportDic.isLoading" nzDisabled nzCustomContent>
                    <i nz-icon type="loading" class="loading-icon"></i>加载中...
                </nz-option>
            </nz-select>
            <nz-button-group>
                <button  nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
                <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
            </nz-button-group>
            <div class="tool-right">
                <nz-button-group>
                    <button *ngIf="ss.mi.sa || ss.mi.dmabxz" nz-button [nzType]="'primary'" (click)="addRow()">新增</button>
                    <!-- <button nz-button (click)="fs.editRow()">编辑</button> -->
                    <button *ngIf="ss.mi.sa || ss.mi.dmabsc" nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
                        nz-button>删除</button>
                  <a nz-button href="assets/images/地面安保.xls" download="地面安保.xls">模板下载</a>
                  <button nz-button (click)="fs.export('xjmh_dmab.html', '地面安保.xls')">导出</button>
                  <nz-upload nzAction="{{ fs.getExcelUploadUrl() }}" [nzLimit]="1" [nzHeaders]="ffs.fileHeaders"
                             [nzFilter]="fs.excelFilters" [nzAccept]="'.xls,.xlsx'" (nzChange)="excelHandleChange($event)">
                    <button *ngIf="ss.mi.sa || ss.mi.dmabxz" nz-button>导入</button>
                  </nz-upload>
                </nz-button-group>
            </div>
        </div>

        <!-- 右则样表单主体 -->
        <div class="work-content">
            <div class="table">
                <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
                    [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
                    [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
                    (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)"
                    [nzScroll]="{ x: '2300px' }">
                    <thead>
                        <tr>
                            <th nzWidth="50px" nzShowCheckbox [(nzChecked)]="fs.allChecked"
                                [nzIndeterminate]="fs.indeterminate" (nzCheckedChange)="fs.checkAll($event)"></th>
                            <th nzWidth="100px">所属机场</th>
                            <th nzWidth="150px">保障进港航班(架次)</th>
                          <th nzWidth="150px">保障出港航班(架次)</th>
                          <th nzWidth="150px">保障进港旅客(人次)</th>
                          <th nzWidth="150px">保障出港旅客(人次)</th>
                          <th nzWidth="150px">出动安检人员(人次)</th>
                          <th nzWidth="100px">检查旅客(人次)</th>
                          <th nzWidth="100px">检查行李(次)</th>
                          <th nzWidth="100px">检查货物(次)</th>
                          <th nzWidth="150px">查货易燃易爆品(件)</th>
                          <th nzWidth="150px">查货仿真、自制枪支（把）</th>
                          <th nzWidth="150px">查货管制器具(把)</th>
                          <th nzWidth="100px">工作时间</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let data of fs.datas">
                            <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
                            </td>
                            <!-- <td><span (click)="fs.editRow(data)" class="form-edit"></span></td> -->
                            <td><span (click)="fs.editRow(data)" class="form-edit">{{data.airportName}}</span></td>
                            <td>{{data.incomeflight === null ? 0 : data.incomeflight}}</td>
                            <td>{{data.outcomeflight === null ? 0 : data.outcomeflight}}</td>
                            <td>{{data.incomepassenger === null ? 0 : data.incomepassenger}}</td>
                            <td>{{data.outcomepassenger === null ? 0 : data.outcomepassenger}}</td>
                            <td>{{data.sendsecurityperson === null ? 0 : data.sendsecurityperson}}</td>
                            <td>{{data.checkpassenger === null ? 0 : data.checkpassenger}}</td>
                            <td>{{data.checkbag === null ? 0 : data.checkbag}}</td>
                            <td>{{data.checkgoods === null ? 0 : data.checkgoods}}</td>
                            <td>{{data.dangergoods === null ? 0 : data.dangergoods}}</td>
                            <td>{{data.guns === null ? 0 : data.guns}}</td>
                            <td>{{data.controlequipment === null ? 0 : data.controlequipment}}</td>
                            <td>{{data.temporaryTime | date:'yyyy-MM-dd'}}</td>
                        </tr>
                    </tbody>
                </nz-table>
            </div>
        </div>

        <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
            (nzOnCancel)="fs.closeEdit()">
            <form nz-form [nzLayout]="'inline'">
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">所属机场</nz-form-label>
                            <nz-form-control class="form-control" [nzValidateStatus]="!fs.er.airport?'error':'success'"
                                nzHasFeedback>
                                <nz-select class="fm-input" [(ngModel)]="fs.er.airport" name="airport" [disabled]="fs.er.airport">
                                    <nz-option *ngFor="let option of airportDic.datas" [nzLabel]="option.display"
                                        [nzValue]="option.id">
                                    </nz-option>
                                    <nz-option *ngIf="airportDic.isLoading" nzDisabled nzCustomContent>
                                        <i nz-icon type="loading" class="loading-icon"></i>加载中...
                                    </nz-option>
                                </nz-select>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">保障进港航班</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="incomeflight.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.incomeflight" name="incomeflight" required
                                    #incomeflight="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">保障出港航班</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="outcomeflight.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.outcomeflight" name="outcomeflight" required
                                    #outcomeflight="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">保障进港旅客</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="incomepassenger.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.incomepassenger" name="incomepassenger" required
                                    #incomepassenger="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">保障出港旅客</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="outcomepassenger.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.outcomepassenger" name="outcomepassenger" required
                                    #outcomepassenger="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">出动安检人员</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="sendsecurityperson.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.sendsecurityperson" name="sendsecurityperson"
                                    required #sendsecurityperson="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">检查旅客</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="checkpassenger.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.checkpassenger" name="checkpassenger" required
                                    #checkpassenger="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">检查行李</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="checkbag.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.checkbag" name="checkbag" required
                                    #checkbag="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">检查货物</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="checkgoods.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.checkgoods" name="checkgoods" required
                                    #checkgoods="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">查货易燃易爆品</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="dangergoods.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.dangergoods" name="dangergoods" required
                                    #dangergoods="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">查货仿真、自制枪支</nz-form-label>
                            <nz-form-control class="form-control" [nzValidateStatus]="guns.invalid?'error':'success'"
                                nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.guns" name="guns" required #guns="ngModel"
                                    [nzMin]="0"  [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">查货管制器具</nz-form-label>
                            <nz-form-control class="form-control"
                                [nzValidateStatus]="controlequipment.invalid?'error':'success'" nzHasFeedback>
                                <nz-input-number [(ngModel)]="fs.er.controlequipment" name="controlequipment" required
                                    #controlequipment="ngModel" [nzMin]="0"  [nzStep]="1"
                                    class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
              <div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                  <nz-form-item>
                    <nz-form-label nzRequired class="form-label">工作日期</nz-form-label>
                    <nz-form-control class="form-control" [nzValidateStatus]="temporaryTime.invalid?'error':'success'"
                                     nzHasFeedback>
                      <nz-date-picker class="fm-input first-input" name="temporaryTime" required
                                      [(ngModel)]="fs.er.temporaryTime" #temporaryTime="ngModel"
                                      name="selectDate"></nz-date-picker>
                    </nz-form-control>
                  </nz-form-item>
                </div>
              </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="24" class="form-button-align">
                        <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
                        <button *ngIf="ss.mi.sa || ss.mi.dmabxz" nz-button nzType="primary" [disabled]='!fs.er.airport' (click)="fs.save()"
                            [nzLoading]="fs.isSaveing">保存</button>
                    </div>
                </div>
            </form>
        </nz-modal>
    </div>
</div>
